<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/wechatLibs.jsp"%>
<!doctype html>
<html>
<head>
<title>找礼包</title>
<meta charset="utf-8">
<meta name="viewport"
	content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
<meta name="format-detection"
	content="telephone=no,email=no,date=no,address=no">
</head>
<body>
	<div class="main my-gift-bag">
		<ul id="bagList">

		</ul>
	</div>
	<!-- 底部菜单 -->
	<div class="h88 mt20"></div>
	<div class="bottom-nav">
		<ul>
         
            <li class="find-project cur">
            <a href="/three/project/windex.jhtml" >
                <i class="ico"></i>
                <span>找项目</span>
             </a>
                
            </li>
          
           
            <li class="find-gift">
             <a href="/three/bag/bagList.jhtml" >
                <i class="ico"></i>
                <span>找礼包</span>
               </a> 
            </li>
           
            
            <li class="mine">
            <a href="/three/home/goHome.jhtml" >
                <i class="ico"></i>
                <span>我的</span>
                </a>
            </li>
            
        </ul>
	</div>
</body>
<script type="text/javascript">
	var toast = new auiToast();
	var timeInterval;
	//页面初始化 
	$(function() {
		doSearch(0);
		timeInterval = window.clearInterval(timeInterval)
		timeInterval = self.setInterval("doSearch(0)", 60000);
	})
	function doSearch(clearStatus) {
		

		$.ajax({
			type : 'post',
			url : '/three/bag/searchBag.jhtml',
			data : {

			},
			dataType : 'json',
			success : function(data) {
				var bagList = $("#bagList");
				var html = '';
				if (clearStatus == '1') {
					html = bagList.html();
				}
				for (var i = 0; i < data.length; i++) {
					var row = data[i];
					html += '<li onclick="showBagDetail(\'' + row.bagId +'\')">'
					html += ' <div class="tit">' + row.bagName + '</div>'
					html += ' <div  ></div>'
					html += ' <div class="box">'
					html += ' <div class="fl">'
					html += ' <span>只剩下'+row.remainNum+'了！ </span>'
					html += '<span>距结束: '+row.bagIntroduce+'</span>'
					html += '</div>'
					html += '<div class="btn"> </div>'
					html += '</div>'
					html += '<img src="/three/' + row.coverPhoto + '">'
					html += '</li>'
				}
				bagList.html(html);
				
			}
		})
	}
	//创建列表数据
	
	function showBagDetail(bag_id) {
		console.log(bag_id)
		window.location.href = '/three/bag/showBagDetail.jhtml?bag_id='
				+ bag_id;
	}
</script>
</html>